package org.paic.d.test

import org.paic.d.Pager

class PagerTest extends GroovyTestCase {

	void testGetTotalPage(){
		def p = new Pager(1, 10)
		p.totalCount = 100

		assert p.totalPage == 10

		p.totalCount = 101
		assert p.totalPage == 11
	}

	void testGetStart(){
		def p = new Pager(1, 10)
		assert p.start == 0

		p.pageNum = 2
		assert p.start == 10
	}

	void testGetEnd(){
		def p = new Pager(1, 10)
		p.totalCount = 8

		assert p.end == 8
		assert !p.hasPre()

		p.totalCount = 99
		assert p.end == 10
		assert p.hasNext()

		p.pageNum = 10
		assert p.end == 99
		assert !p.hasNext()
		assert p.hasPre()
	}
}